<template>
  <a-timeline>
    <a-timeline-item v-show="!isCheckDetail">
      <div class="upload" @click="handelAddFollow">
        <icon-plus />
        <div class="">添加跟进</div>
      </div>
    </a-timeline-item>
    <template v-if="followUpData.length">
      <a-timeline-item v-for="item in followUpData as any">
        <div class="timeline-item-title">
          <span>{{ item.date }}</span>
          <span class="gray-text schedule"><icon-schedule />{{ item.time }}</span>
        </div>
        <div class="timeline-item-type">{{ item.trackTypeName }}</div>
        <div class="followUp-content">
          <div class="followUp-msg">{{ item.contentDesc }}</div>
          <div class="photo-wall">
            <div class="photo-wall-item" v-for="imgItem in item.crmFileVOList" :key="imgItem.url">
              <a-image height="100%" width="100%" :src="imgItem.url" />
            </div>
          </div>
          <div class="gray-text">提交人：{{ item.roleName }}</div>
        </div>
      </a-timeline-item>
    </template>
    <a-empty v-else />
  </a-timeline>
</template>

<script setup lang="ts">
defineProps({
  isCheckDetail: Boolean,
  followUpData: {
    type: Array,
    default: () => []
  }
});
const emit = defineEmits(["addFollow"]);

/**
 * 添加跟进
 */
const handelAddFollow = () => {
  emit("addFollow");
};
</script>

<style scoped lang="scss">
:deep(.arco-timeline-item) {
  min-height: auto;
  padding-bottom: 35px;
}
:deep(.arco-timeline) {
  flex: 1;
  overflow-y: auto;
}

.upload {
  width: 100px;
  height: 100px;
  background: #f2f3f5;
  border-radius: 4px 4px 4px 4px;
  color: #86909c;
  text-align: center;
  padding-top: 20px;
  box-sizing: border-box;

  ::v-deep(.arco-icon) {
    font-size: 36px;
  }

  > div {
    width: 100%;
  }
}
.timeline-item-title {
  @include flex-align;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.6);
  line-height: 24px;
  .schedule {
    svg {
      margin: 0 4px 0 8px;
    }
  }
}
.timeline-item-type {
  margin: 10px 0 4px;
  font-size: 16px;
  color: rgba(0, 0, 0, 0.9);
  line-height: 24px;
}
.followUp-content {
  padding: 10px;
  background-color: #f2f3f5;
  border-radius: 4px;

  .followUp-msg {
    word-break: break-word;
    white-space: normal;
    font-size: 14px;
    color: #3d3d3d;
    line-height: 24px;
  }

  .photo-wall {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin: 8px auto;

    &-item {
      width: 100%;
      height: 85px;
      border-radius: 4px;
    }
  }
}

.gray-text {
  font-size: 12px;
  color: #86909c;
  line-height: 24px;
}
</style>
